import logging
import os
from logging import config


def setup_logger():
    if not os.path.exists('apirunner/log'):
        os.makedirs('apirunner/log')

    config_path = os.path.join(os.path.dirname(__file__), 'config/logging.ini')
    logging.config.fileConfig(config_path)
    # 设置 apirunner 全局 logger
    logger = logging.getLogger('apirunner')
    return logger
